<template>
	<view class="score-box">
		<!-- #ifdef APP-PLUS -->
		<view class="status_bar">
			<view class="top_view"></view>
		</view>
		<!-- #endif -->
		<view class="score-title">体测成绩</view>
		<!-- <view class="search">
			<view class="search-box">
				<uni-icons type="search" size="16" color="#AAAAAA"></uni-icons>
				<input type="text" placeholder="请输入名称">
			</view>
			<button>搜索</button>
		</view> -->
		<view class="score-item" v-for="item in listData">
			<view class="score-text">
				<text>{{item.tcname}}</text>
				<button @click="gotoPage(item)">查看成绩</button>
			</view>
			<image src="/static/images/img3.png" mode="widthFix"></image>
		</view>
		<view v-if="noMore" class="no-more">
			<text>没有更多</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listData:[],
				pageNum:1,
				pageSize:7,
				noMore: false
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.listData = []
			this.getList()
		},
		onReachBottom() {
		    if (!this.noMore) {
		      this.pageNum++
		      this.getList()
		    }
		},
		methods: {
			async getList() {
				let res = await this.http('get', "/tc/tcOperate/tcnameList", {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
				})
				if (res.code == 200) {
					// this.listData = res.rows
					// 数据拼接处理
					this.listData = [...this.listData, ...res.rows]
					// 判断是否还有数据
					this.noMore = res.rows.length < 7
				}
				console.log(res)
			},
			gotoPage(item){
				uni.navigateTo({
					url:'/pages/score/scoreList?id='+item.id
				})
			}
		}
	}
</script>

<style lang="less">
	page{
		width: 100%;
		height: 100%;
	}
	.score-box{
		width: 100%;
		min-height: 100%;
		padding: 40upx;
		box-sizing: border-box;
		background: url('/static/images/bg5.png') no-repeat;
		background-size: 100%;
		.score-title{
			font-size: 40upx;
			font-weight: 600;
			color: #1A1A1A;
			padding: 40upx 0 20upx 0;
			margin-bottom: 30upx;
		}
		.search{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 20upx;
			.search-box{
				display: flex;
				align-items: center;
				width: calc(100% - 124upx);
				height: 56upx;
				border-radius: 86upx;
				background: #F5F7F9;
				padding: 0 20upx;
				box-sizing: border-box;
				input{
					font-size: 24upx;
					margin-left: 10upx;
				}
			}
			button{
				width: 104upx;
				height: 56upx;
				border-radius: 32upx;
				background: linear-gradient(180deg, #4F9FE0 0%, #3673E1 100%);
				font-size: 24upx;
				color: #fff;
				margin: 0;
			}
		}
		.score-item{
			width: 100%;
			margin-bottom: 20upx;
			background: linear-gradient(180deg, #99C6F7 0%, #4D9BEE 100%);
			border-radius: 20upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.score-text{
				padding: 30upx;
				box-sizing: border-box;
			}
			image{
				width: 160upx;
				height: auto;
			}
			text{
				font-size: 36upx;
				color: #fff;
			}
			button{
				width: 160upx;
				line-height: 50upx;
				border-radius: 40upx;
				background: #FBD101;
				font-size: 24upx;
				color: #1A1A1A;
				margin: 20upx 0 0 0;
			}
		}
	}
</style>